home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14999 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  89 lines

  1. Path: news.mel.aone.net.au!usenet
  2. From: awedding@iig.com.au
  3. Newsgroups: comp.lang.c++
  4. Subject: A little programme I am having trouble with - ass1.cpp (0/1)
  5. Date: Wed, 03 Apr 1996 00:02:35 GMT
  6. Message-ID: <4jsf4q$f9o@news.mel.aone.net.au>
  7. NNTP-Posting-Host: cnsta03.iig.com.au
  8. X-Newsreader: Forte Free Agent 1.0.82
  9.  
  10. Hi everyone, 
  11.  
  12.      I am tring to write the programme below but keep getting the
  13. message "Possibly incorrect assignment in function main()" Could
  14. someone PLEASE help me. If you could Email your response to 
  15.  
  16. awedding@iig.com.au
  17.  
  18. I would be more than grateful.
  19. Thanks in advance
  20.  
  21.  
  22. /* This programme is used to calculate the cost of a phone call after
  23. the
  24. user has entered the time of call and duration of call.
  25.  
  26. Input         : Time that call was made,  in minutes and seconds
  27.                 : Length of call,  in minutes and seconds
  28.                 : Distance of call,  in Kilometers
  29.  
  30. Output        : The cost of the phone call
  31.  
  32. Constants     : The amount charged at a certain time and distance
  33.  
  34. ---------------------------------------------------------------------
  35. */
  36.  
  37. #include <iostream.h>
  38. void main ( void )
  39. {
  40.     int
  41.         TimeScale, DistCalled, DurMin, DurSec, D, N, E, Distance ;
  42.  
  43.     double
  44.         CostPerMin ;
  45.  
  46.     cout << "Enter the time scale used (D/N/E)" ;
  47.     cin >> TimeScale ;
  48.     cout << "Enter the distance called" ;
  49.     cin >> DistCalled ;
  50.     cout << "Enter the duration of the call (Min & Sec" ;
  51.     cin >> DurMin >> DurSec ;
  52.  
  53.     if ((TimeScale = D) && (Distance >745))
  54.         cin >> CostPerMin = 0.55 ;
  55.     else if ((TimeScale = D) && (Distance <745) && (Distance >165))
  56.         cin >> CostPerMin = 0.375 ;
  57.     else if ((TimeScale = D) && (Distance <165) && (Distance >85))
  58.         cin >> CostPerMin = 0.35 ;
  59.     else if ((TimeScale = D) && (Distance <85) && (Distance >25))
  60.         cin >> CostPerMin = 0.15 ;
  61.  
  62. // The above is if the user called during the DAY time scale
  63.  
  64.  
  65.     if ((TimeScale = N) && (Distance >745))
  66.         cin >> CostPerMin = 0.375 ;
  67.     else if ((TimeScale = N) && (Distance <745) && (Distance >165))
  68.         cin >> CostPerMin = 0.25 ;
  69.     else if ((TimeScale = N) && (Distance <165) && (Distance >85))
  70.         cin >> CostPerMin = 0.25 ;
  71.     else if ((TimeScale = N) && (Distance <85) && (Distance >25))
  72.         cin >> CostPerMin = 0.10 ;
  73.  
  74. // The above is if the user called during the NIGHT time scale
  75.  
  76.     if ((TimeScale = D) && (Distance >745))
  77.         cin >> CostPerMin = 0.225 ;
  78.     else if ((TimeScale = D) && (Distance <745) && (Distance >165))
  79.         cin >> CostPerMin = 0.15 ;
  80.     else if ((TimeScale = D) && (Distance <165) && (Distance >85))
  81.         cin >> CostPerMin = 0.15 ;
  82.     else if ((TimeScale = D) && (Distance <85) && (Distance >25))
  83.         cin >> CostPerMin = 0.075 ;
  84.  
  85. // The above is if the user called during the ECONOMY time scale
  86.  
  87. }
  88.  
  89.